def get_navigation_info(current_position, room_data, next_room=2, boss_room=3):
    """
    根据当前位置和房间数据，判断当前所在房间和推荐行进方向

    参数:
    current_position (tuple): 当前位置的坐标 (x, y)
    room_data (list): 格式为 [(room_id, [x, y, conf]), ...] 的房间数据
    next_room (int): 下一个房间的ID
    boss_room (int): BOSS房间的ID

    返回:
    dict: 包含当前房间ID和推荐方向的字典
    """
    # 1. 计算当前位置到各房间的距离
    distances = {}
    for room_id, (room_x, room_y, conf) in room_data:
        distance = ((current_position[0] - room_x) ** 2 +
                    (current_position[1] - room_y) ** 2) ** 0.5
        distances[room_id] = distance

    # 2. 判断当前所在房间（距离最近且置信度足够）
    current_room = min(distances.items(), key=lambda x: x[1])[0]

    # 3. 确定推荐行进方向
    direction = ""
    if current_room == 1:  # 当前在房间1（起始房间）
        direction = f"前往下一个房间 {next_room}"
    elif current_room == next_room:  # 当前在中间房间
        direction = f"前往BOSS房间 {boss_room}"
    elif current_room == boss_room:  # 当前在BOSS房间
        direction = "已到达BOSS房间，准备战斗！"
    else:  # 当前在其他房间
        direction = f"前往下一个房间 {next_room}"

    return {
        "current_room": current_room,
        "direction": direction
    }


# 示例数据
room_data = [
    (0, [420.77, 330.98, 0.97]),  # 假设0是起始房间
    (1, [761.94, 61.05, 0.96]),  # 当前房间
    (2, [780.05, 61.07, 0.96]),  # 下一房间
    (3, [780.04, 96.89, 0.94])  # BOSS房间
]

# 假设当前位置
current_position = (760, 60)  # 靠近房间1的位置

# 获取导航信息，显式传递next_room和boss_room参数
navigation = get_navigation_info(current_position, room_data, next_room=2, boss_room=3)
print(f"当前位于房间: {navigation['current_room']}")
print(f"推荐方向: {navigation['direction']}")